package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.NumberUtils;
import com.stark.calculator.tax.constant.TaxConst;
import com.stark.calculator.tax.model.TaxCalRetBean;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityTaxKind1RetBinding;
import flc.ast.databinding.ActivityTaxKind2RetBinding;
import stark.common.basic.event.EventStatProxy;

public class TaxKind2RetActivity extends BaseAc<ActivityTaxKind2RetBinding> {

    public static void start(Context context, TaxCalRetBean retBean) {
        Intent intent = new Intent(context, TaxKind2RetActivity.class);
        if (!(context instanceof Activity)) {
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        intent.putExtra(TaxConst.KEY_RET_MODEL, retBean);
        context.startActivity(intent);
    }

    @Override
    protected int onCreate() {
        return R.layout.activity_tax_kind2_ret;
    }

    @Override
    protected void initView() {
        TaxCalRetBean retBean = null;
        Intent intent = getIntent();
        if (intent != null) {
            retBean = (TaxCalRetBean) intent.getSerializableExtra(TaxConst.KEY_RET_MODEL);
        }
        //到手所得
        mDataBinding.tvTaxKind2Resul1.setText(NumberUtils.format(retBean.handSalary, 2));
        //个人所得税
        mDataBinding.tvTaxKind2Sds.setText(NumberUtils.format(retBean.personalIncomeTax, 2));
        //税前收入
        mDataBinding.tvTaxKind2Sqsr.setText(NumberUtils.format(retBean.salaryBeforeTax, 2));
        mDataBinding.ivTaxKind2RetBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

    @Override
    protected void initData() {

    }

}